from fasc_api.client.service_client import ServiceClient
from fasc_api.client.template_client import TemplateClient
from fasc_api.exception.exceptions import ClientException
from fasc_api.exception.exceptions import ServerException

from init_demo_data import InitDemoData
api_client = InitDemoData.api_client
access_token = ServiceClient.get_access_token_value(api_client)
api_client.set_access_token(access_token)


# 获取模板管理链接
def get_page_manage_url_template_demo():
    try:
        data = {
            # 法大大平台为该企业在该应用appId范围内分配的唯一标识
            'openCorpId': InitDemoData.openCorpId,
            'redirectUrl': '重定向地址'
        }
        res = TemplateClient.get_pagemanage_url(api_client, data)
        print(res)
    except ClientException as e:
        print(e.__str__())
    except ServerException as e:
        print(e.__str__())

if __name__ == '__main__':
    get_page_manage_url_template_demo()